<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>快招</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<link rel="stylesheet" href="/public/weixin/css/mui.min.css">
		<link rel="stylesheet" href="/public/weixin/css/iconfont/iconfont.css" />
		<link rel="stylesheet" href="/public/weixin/css/css/index.css">
	</head>
	
<body>
	<header class="mui-bar mui-bar-nav">
		<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left" onclick="window.history.back();"></a>
		<h1 class="mui-title">个人信息</h1>
	</header>

		<div class="mui-content">
			<form method="post" id="frm">
			<p class="own_shenqing_p">
				请如实填写个人资料
			</p>
			<div class="own_shenqing">
				<div class="own_shenqing_list">
					<div class="own_shenqing_item">
						姓名
					</div>
					<div class="own_shenqing_item">
						<input type="text" id="name" name="name" value="<?php echo ($data["name"]); ?>" placeholder="请填写真实姓名"/>
					</div>
				</div>
				<div class="own_shenqing_list">
					<div class="own_shenqing_item">
						手机号
					</div>
					<div class="own_shenqing_item">
						<input type="tel" id="mobile" name="mobile" value="<?php echo ($data["mobile"]); ?>" placeholder="请填写手机号码"/>
					</div>
				</div>
				<div class="own_shenqing_list">
					<div class="own_shenqing_item">
						身份证
					</div>
					<div class="own_shenqing_item">
						<input type="text" id="card" name="card" value="<?php echo ($data["card"]); ?>" placeholder="请填写个人身份证号码"/>
					</div>
				</div>
				
				<div class="own_shenqing_list">
					<div class="own_shenqing_item">
						性别
					</div>
					<div class="own_shenqing_item">
						<?php echo ($sex); ?>
					</div>
				</div>
			</div>
			<div class="own_shenqing_button">
				<div class="mui-content-padded">
					<button type="button" id="saveBtn" class="mui-btn mui-btn-primary mui-btn-block">保存</button>
				</div>
			</div>
			</form>
		</div>
</body>
<script src="/public/js/mui/js/mui.js"></script>
<script src="/public/js/jquery.js"></script>
<script type="text/javascript">
$(function() {
	$("#saveBtn").click(function(){
		var $user_id = <?php echo ($data["id"]); ?>;
		var $name = $("#name").val();
		var $card = $("#card").val();
		var $mobile = $("#mobile").val();
		var $sex = $("#sex").val();
		if($name == ''){
			mui.toast("真实姓名不能为空！");
			return;
		}
		if($mobile == ''){
			mui.toast("手机号码不能为空！");
			return;
		}
		if($card == ''){
			mui.toast("身份证不能为空！");
			return;
		}
		if($sex == ''){
			mui.toast("性别不能为空！");
			return;
		}
		mui.ajax("<?php echo U('User/user_detail_post');?>",{
			data : {
				"id" : $user_id,
				"name" : $name,
				"mobile" : $mobile,
				"card" : $card,
				"sex" : $sex
			},
			dataType : 'json',//服务器返回json格式数据
			type : 'post',//HTTP请求类型
			timeout : 10000,//超时时间设置为10秒；
			success : function(data){
				//服务器返回响应，根据响应结果，分析是否登录成功；
				if (data['state'] == 1) {
					mui.alert(data['msg']);
				}else{
					mui.alert(data['msg']);
				}
			},
			error:function(xhr,type,errorThrown){
				//异常处理；
				console.log(type);
			}
		});
	});
});
</script>
</html>